package com.chen.apipassenger.service;

import com.chen.apipassenger.remote.ServicePriceClient;
import com.chen.internalcommon.dto.ResponseResult;
import com.chen.internalcommon.request.ForecastPriceRequest;
import com.chen.internalcommon.response.ForecastPriceResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author chenLiuPing
 **/
@Service
@Slf4j
public class ForecastPriceService {

    @Autowired
    private ServicePriceClient servicePriceClient;

    public ResponseResult forecastPrice(String depLongitude, String depLatitude, String destLongitude, String destLatitude, String cityCode, String vehicleType) {
        log.info("forecastPrice start");
        ResponseResult<ForecastPriceResponse> responseResult = servicePriceClient.forecastPrice(new ForecastPriceRequest(depLongitude, depLatitude, destLongitude, destLatitude, cityCode, vehicleType));
        ForecastPriceResponse priceResponse = responseResult.getData();
        log.info("调用service-price 服务获取的价格：{}", priceResponse.getPrice());
        return ResponseResult.success(priceResponse);
    }
}
